Module 4 - Diffusion-limited Aggregation

Author: Neil Tramsen

Group Members: Gustavo Borjas, Bonning Xu, Christopher Liu

In this project, we develop a computational model for diffusion-limited aggregation (DLA). DLA forms branching structures formed by randomly moving particles, that become stationary and frozen in place when they come into contact with other particles, forming a solid structure. This can be used to model a wide variety of real life processes in Physics and Chemistry, including the movement of metal ions on to an electrode, the coalescing of dust and smoke particles, and the growth of some crystals.

This notebook takes around a minute to run completely.

Problem Analysis

Physical Considerations

DLA structures form due to randomly moving particles, that become frozen in place when they hit a stationary structure made up of other particles. Our main physical consideration is the space in which the particle moves. For this purpose, we will create a lattice, in which the particle can take random steps left or right, and up or down. While this doesn't provide a perfectly accurate simulation of the real world, in which particles can take steps in any direction, as the lattice and number of walkers gets bigger, this discretised set of directions will approximate a random walk in which a particle can move in any direction.

As there are no conclusive analytical equations for this model, we will heavily rely on robust and accurate programming to turn this physical model into a computational model.

Coding Considerations

For the first particle to become stationery, we will have to create the lattice with one particle already stationary on it, with which the first particle has to come into contact to become stationary. This poses a problem: if the random walk walk was started in a random location, it may take a very long time, and a very large number of steps, before the particles come into contact. Ideally, the particles would come from infinity, but ofcourse the lattice has a finite size, and the average distance covered by a random walk is $\sqrt{N}$, where N is the number of steps. For this reason, in this project we will create a circle around the stationary structure, with a radius just larger than the structure's radius, and we will place the particle on a random point on this circles radius. If the particle tries to leaves this circle, we will ignore this step, and generate new random steps until the particle continues moving inward. This simulates the particle approaching randomly from infinity, and also ensures the particle will hit the structure relatively quickly.

There are two main ways to approach this problem: it could be represented as a cellular automaton simulation for which each cell in the lattice would adhere to a set of rules, or it can be represented as an agent-based simulation, in which we would track each walker which behaves according to a set of rules. For this project it is actually most useful to use a combination of the two, as we have agents moving on a lattice of discretised cells. We will release a single particle on to the lattice, track its motion, and then check the cells around it to see if they contain another particle, like in cellular automaton.

Model Development

To start the walker, we will take the current radius of the structure plus 1, and pick a random angle $0<\theta<2\pi$. The initial position of the walker will be $$ x = r\cos{\theta},$$ $$y=r\sin{\theta}.$$ Both the $x$ and $y$ coordiantes must be converted to integers to represent positions on the lattice. Another random number will be used to determine a random direction for the walker to move in. A while loop will continue generating steps until the step moves inwards in the circle, and each subsequent step will be checked such that the particle never leaves the original circle.

Once the particle has come to a stop, the radius of the structure will be recalculated, and the next particle will be placed on the lattice.

Model Implementation

Initialising Python

This notebook can be used to generate a movie of the DLA structure growing. To do this, one must have html_movie.py saved to the same directory as this notebook, and uncomment all lines beginning with #***. html_movie.py is available at: http://physicalmodelingwithpython.blogspot.com/p/code-samples.html.

Initialising a walker

Random walk

DLA Function

Verification

Cluster Radius

As we add particles, the radius of the cluster increases. However, the increase is not linear, and the goal of this section is to make an estimate of the relationship between the number of particles and the radius size using numpy's least squares algorithm.

The first graph confirms that the relationship between the number of particles and the radius is not linear. $$y=x^a$$ $$\ln{y}=a\ln{x}$$ We take the logarithm of both the x and y values, which does result in a linear graph, especually for larger values of $N$, the number of particles. We the find the gradient using numpy's least squares regression algorithm, and find the value for $a$ to be approximately 0.5. This means that $R=\sqrt{N}$. This makes sense, as at first adding a walker will have a much larger effect on the radius, as that one walker amkes up a much greater proportion of the structure. However, as $N$ gets very large, adding a walker adds very little to the circe, and thus the increase in radius is minimal.

An alternative DLA structure

Not all DLA structures are formed around a central point. For an example, an anode or cathode could be represented as a line pf particles, that attract ions and cause them to become stationary when they come into contact. This is easily implemented by editing the above functions a little.

Structure growth timelapse

The following code generates a timelapse of the structure growing, in the form of a few lattices at different times. It also generates a movie using the imported python program, html_movie.py, the file for which must be saved in the same location as this notebook for this code to execute. Editing the notification parameter will change the number of timelapse images, as well as the number of images used in the movie. TO generate the movie, uncomment all lines beginning with #***.

Conclusion

This project successfully implements a computational model for DLA, which is adapatable for different patterns of DLA caused by different initial structures. Our model implements a circular structure, with an initial central particle, and a structure oriented to one side, with an initial line of particles. The structures are formed using particles that make truly random walks across the lattice. The outcome is an aesthetically pleasing, natural, and unpredictable structure. We also succesfully determine the realtionship between the radius of the structure, and the number of particles in the structure, which is $R=\sqrt{N}$.